package router

import (
	"server/application/constant/apis"
	"server/application/controller/sysctrl"
	"server/application/db/system/dbdto"
	"server/application/dto"
	"server/pkg/ginp"
)

func init() {

	//创建
	AppendRouter(ItemInfo{ //create
		Path:           apis.ApiSysDictionaryCreate,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.SysDictionaryCreate), //对应控制器
		HttpType:       HttpPost,                                      //http请求类型
		NeedLogin:      true,                                          //是否需要登录
		NeedPermission: true,                                          //是否需要鉴权
		PermissionName: "SysDictionary.create",                        //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:      "创建字典",
			RequestDto: dbdto.SysDictionaryCreate{},
		},
	})

	//修改
	AppendRouter(ItemInfo{ //update
		Path:           apis.ApiSysDictionaryUpdate,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.SysDictionaryUpdate), //对应控制器
		HttpType:       HttpPost,                                      //http请求类型
		NeedLogin:      true,                                          //是否需要登录
		NeedPermission: true,                                          //是否需要鉴权
		PermissionName: "SysDictionary.update",                        //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:      "修改字典",
			RequestDto: dbdto.SysDictionaryUpdate{},
		},
	})

	// 删除
	AppendRouter(ItemInfo{ //delete
		Path:           apis.ApiSysDictionaryDelete,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.SysDictionaryDelete), //对应控制器
		HttpType:       HttpPost,                                      //http请求类型
		NeedLogin:      true,                                          //是否需要登录
		NeedPermission: true,                                          //是否需要鉴权
		PermissionName: "SysDictionary.delete",                        //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:      "删除字典",
			RequestDto: dbdto.SysDictionaryDelete{},
		},
	})

	//search 搜索
	AppendRouter(ItemInfo{ //search
		Path:           apis.ApiSysDictionarySearch,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.SysDictionarySearch), //对应控制器
		HttpType:       HttpPost,                                      //http请求类型
		NeedLogin:      true,                                          //是否需要登录
		NeedPermission: true,                                          //是否需要鉴权
		PermissionName: "SysDictionary.search",                        //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:      "获取字典列表",
			RequestDto: dto.ReqSearch{},
		},
	})

	//获取一个key的options
	AppendRouter(ItemInfo{ //search
		Path:           apis.ApiSysDictionaryGetOptions,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.SysDictionaryGetOptions), //对应控制器
		HttpType:       HttpPost,                                          //http请求类型
		NeedLogin:      false,                                             //是否需要登录
		NeedPermission: false,                                             //是否需要鉴权
		PermissionName: "",                                                //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title: "根据key查询字典options",
			RequestDto: dto.ReqGetDicOptions{
				DicKeyName: "test",
			},
		},
	})

	AppendRouter(ItemInfo{
		Path:           apis.ApiSysDictionaryGetString,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.SysDictionaryGetString), //对应控制器
		HttpType:       HttpPost,                                         //http请求类型
		NeedLogin:      false,                                            //是否需要登录
		NeedPermission: false,                                            //是否需要鉴权
		PermissionName: "",                                               //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:       "SysDictionaryGetString",
			RequestDto:  dto.ReqSysDictionaryGetString{},
			Description: "",
		},
	})

	AppendRouter(ItemInfo{
		Path:           apis.ApiSysDictionarySetString,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.SysDictionarySetString), //对应控制器
		HttpType:       HttpPost,                                         //http请求类型
		NeedLogin:      false,                                            //是否需要登录
		NeedPermission: false,                                            //是否需要鉴权
		PermissionName: "",                                               //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:       "SysDictionarySetString",
			RequestDto:  dto.ReqSysDictionarySetString{},
			Description: "",
		},
	})
	//{{append}}

}
